<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="../docs-assets/ico/favicon.png">

    <title>Signin Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="../dist/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="../dsit/css/signin.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
  
<!-- NAVBAR
================================================== -->  
    <div class="navbar-wrapper">
      <div class="container">

        <div class="navbar navbar-inverse navbar-static-top" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
             
            </div>
            <div class="navbar-collapse collapse">
              <ul class="nav navbar-nav">
                <li class="active"><a href="adminupmc.html">Accueil</a></li>
                <li><a href="#about"></a></li>
				<li><a href="manage.html">Gérer les incidents</a></li>
				<li><a href="#about"></a></li>
				<li class="dropdown">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown">Diffuser des infos <b class="caret"></b></a>
				    <ul class="dropdown-menu">
						<li><a href="diffuserinfos.html">Déposer une information</a></li>
						<li class="divider"></li>
						<li><a href="consulter-infos.html">Consulter les informations</a></li>
						<li class="divider"></li>
					</ul>
				</li>
                <li class="dropdown">
				  <li><a href="objetsperdustrouves.html">Objet perdus/trouvés</a></li>
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Compte <b class="caret"></b></a>
                  <ul class="dropdown-menu">
					<li class="dropdown-header"> <div id="user-info" hidden> Enregistré comme  <span id="us"> </span></div> </li>
						<li><a href="#" class="log-out">Déconnexion</a></li>
                    <li class="divider"></li>
                  </ul>
				</li>
              </ul>
            </div>
          </div>
        </div>

      </div>
    </div>

	<!-- ENTER INFORMATION
================================================== -->
	<div id = "check-out" style = "display:block;text-align: center;border:solid;border-color:#B59775;background-color:#D7B997;margin-right:20%;margin-left:20%;margin-bottom: auto;margin-top: auto;padding:auto;">
	</div>
	<div style = "display:block;text-align: center;border:solid;border-color:#B59775;background-color:#D7B997;margin-right:20%;margin-left:20%;margin-bottom: auto;margin-top: auto;padding:auto;">

	</div>

    </div> <!-- /container -->
	<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
    <script src="../js/underscore-1.1.6.js"></script>
	<script src="http://www.parsecdn.com/js/parse-1.2.15.min.js"></script>



    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
	<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
    <script src="../js/underscore-1.1.6.js"></script>
    
	<script src="http://www.parsecdn.com/js/parse-1.2.15.min.js"></script>
    <script src="../dist/js/bootstrap.min.js"></script>
    <script src="../docs-assets/js/holder.js"></script>
	<script src="../js/logInInfo.js"></script>
	<script>
		$(function(){
			

			 function createContainerAndInsert(containerId,type,data){
				var new_element3 = document.createElement(type);
				new_element3.innerHTML = data;
				$(containerId).append(new_element3);
			 }
			 function getData(){				
				var InformationModel = Parse.Object.extend("InformationModel");
				var query = new Parse.Query(InformationModel);

				query.include(["publishedBy"]);
				query.find({
				  success: function(results) {
					var entete = '<h1 style="text-color:black;text-align: center;font-weight:bold">Liste des informations postées</h1>';
					createContainerAndInsert("#check-out","h1",entete);


					for (var i = 0; i < results.length; i++) { 
					  var object = results[i];
					var urltof = object.get('photo');
					  var data = '<div style="border-top:solid;border-color:#B59775;background-color:#D7B997;padding:auto;margin-left:auto;margin-right:auto;margin-bottom:auto;margin-top:auto;"><div style = "display:block-inline;margin:auto;"></div><div style="display:block-inline;margin:auto;">' +
								'<p>'+'Crée le: '+object.createdAt+'</br>'+'</p>'+
								'<h3>'+'Publié par: '+object.get("publishedBy").get("username")+'</br>'+'</h3>'+
								'<h2>'+object.get('title')+'</br>'+'</h2>';
								if(urltof != null)
									data+='</br></br>'+'<img width="200" height="150" alt="photo_incident" src='+urltof.url()+'></img>'+'</br></br>';
								data+=' Description : '+ object.get('description')+'</br>'+'</br>'+
								'<p>'+' Classe(s) concernée(s) : '+ object.get('recipients')+ '</br>'+'</p>'+
								'<p>'+' Lien URL :'+ object.get('link')+'<p>'+
								'</div></div>';
						createContainerAndInsert("#check-out",'div',data);
					}
				  },
				  error: function(error) {
					alert("Error: " + error.code + " " + error.message);
				  }
				});
			 }

			 getData();
			 
		});
	</script>

  </body>
</html>

